@extends('layouts.master3')
@section("title","千里码-讨论区")
@section("css")
    <link href="/css/base.css" rel="stylesheet">
    <link href="/css/discuss.css" rel="stylesheet">
@endsection
@section("content")
    <?php
    use App\Utils;
    ?>
    <div class="contain">

        <div class="qa-body-wrapper">
            <!--<div class="qa-header">-->
            <!--<div class="qa-header-clear">-->
            <!--</div>-->
            <!--<form class="qa-search-bar" method="get" action="" _lpchecked="1">-->
            <!--<div class="input-group">-->
            <!--<input type="text" name="q" value="" class="form-control" placeholder=" Search">-->
            <!--<span class="input-group-btn">-->
            <!--<button type="submit" class="btn btn-primary">-->
            <!--&nbsp;<span class="glyphicon glyphicon-search">-->
            <!--</span>&nbsp;</button>-->
            <!--</span>-->
            <!--</div>-->
            <!--</form>-->
            <!--<a href="./ask" class="btn btn-success btn-lg qa-ask-btn">提问</a>-->
            <!--</div>-->
            <!-- ql-header E-->
            <div class="qa-main-shadow">
                <div class="qa-main-wrapper">
                    <div class="fl">
                        @if($tag!="all")
                            <div class="qa-module">
                                <div class="qa-module-title"><a target="_blank"
                                                                href="/task/{{Utils::id2url($task->id)}}">{{$tag}}</a>
                                </div>
                                <div class="qa-module-detail clear">
                                    <p>{{$task->material}}</p>
                                    <span class="fr"> ——{{$task->user->name}}</span>
                                </div>
                            </div>
                            @endif
                                    <!-- qa-module E -->
                            <div class="qa-nav-main">
                                <ul class="qa-nav-main-list">
                                    <li class="qa-nav-main-item qa-nav-main-new">
                                        <a href="/discuss/{{$tag}}/new" class="qa-nav-main-link">最新</a>
                                    </li>
                                    <li class="qa-nav-main-item qa-nav-main-hot">
                                        <a href="/discuss/{{$tag}}/hot" class="qa-nav-main-link">热门</a>
                                    </li>
                                    <li class="qa-nav-main-item qa-nav-main-unanswered">
                                        <a href="/discuss
/{{$tag}}/unanswered" class="qa-nav-main-link">未回答</a>
                                    </li>
                                </ul>

                                <div class="qa-nav-main-clear">
                                </div>

                            </div>

                            <div class="qa-main">
                                <!--<h1>最新问题与解答</h1>-->
                                <div class="qa-part-q-list">
                                    <div class="qa-q-list qa-q-list-vote-disabled">
                                        @if(count($articles)==0) 暂无分享文章 @endif
                                        @foreach($articles as $art)
                                            <div class="qa-q-list-item" id="{{$art->id}}">
                                                <div class="qa-q-item-stats">
                                                    <div class="vote pull-left mr_t10">
                                                        <button class="up  @if($art['fav']==0) press @endif"
                                                                data-token="{{csrf_token()}}" data-id="{{$art->id}}"
                                                                data-type="2" title="赞同"
                                                        @if (Auth::check() && $art->userid == Auth::user()->id)
                                                                disabled
                                                        @endif
                                                        >
                                                            @if (Auth::check() && $art->userid != Auth::user()->id)
                                                                <i class="vote_arrow"></i>
                                                            @endif
                                                            <span class="count"
                                                                  data-count="{{$art->score}}">{{$art->score}}</span>
                                                        </button>
                                                        <!--  <button class="down" data-statu="false" title="反对，不显示名字">
                                                              <i class="vote_arrow"></i>
                                                          </button>-->
                                                    </div>
                                                </div>
                                                <div class="qa-q-item-main">
                                                    <div class="qa-q-item-title">
                                                        <a target="_blank" href="{{$art->content}}"><span
                                                                    title="">{{$art->title}}</span></a>
                                                    </div>
                                                    <p class="mr0">{{$art->suggest}}</p>
                                    <span class="qa-q-item-avatar-meta">
                                        <span class="qa-q-item-meta">
                                            <!-- <span class="black">【原创】 </span> -->
                                            <span class="qa-q-item-when">{{$art->created_at}}</span>
                                            <a class="qa-q-item-class gray"
                                               href="/article/{{$art->tag}}">{{$art->tag}}</a>
                                            
                                        </span>
                                    </span>
                                                </div>
                                                <div class="qa-q-item-avatar pull-right"><a
                                                            href="/profile/{{Utils::id2url($art->author->id)}}"
                                                            target="_blank"><img
                                                                src="{{$art->author->avatar->url('thumb')}}"></a></div>
                                                <div class="qa-q-item-clear"></div>
                                            </div>
                                            <!-- END qa-q-list-item -->
                                        @endforeach
                                        <?php echo $articles->render();?>
                                    </div> <!-- END qa-q-list -->
                                </div>
                            </div>
                    </div>
                    <div class="fr">
                        <a href="/genart" target="_blank" class="btn btn-success pull-right ask-q">分享文章</a>
                        <div class="clear"></div>
                        <!-- nav-main E-->
                        <div class="qa-sidepanel">
                            <div class="qa-sidebar well">
                                @include('dis.bulletin')
                            </div>
                        </div>
                        <!-- qa-sidebar E-->
                    </div>

                </div>
            </div>
        </div>

    </div>
@endsection
@section('js')
    <script src="/js/vote.js"></script>
@endsection
